package com.shiwaixiangcun.customer.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shiwaixiangcun.customer.R;
import com.shiwaixiangcun.customer.glide.ImageDisplayUtil;
import com.shiwaixiangcun.customer.module.homeservice.ServiceData;
import com.shiwaixiangcun.customer.widget.RoundImageView;

import java.util.List;

/**
 * Author   Administrator
 * Date     2018/1/17
 * Desc     eg
 *
 * @author Administrator
 */

public class AdapterHouseService extends BaseQuickAdapter<ServiceData, BaseViewHolder> {
    public AdapterHouseService(@Nullable List<ServiceData> data) {
        super(R.layout.item_layout_house_service, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ServiceData item) {
        TextView tvUnit = helper.getView(R.id.tv_unit);
        TextView tvPrice = helper.getView(R.id.tv_house_price);
        RoundImageView ivCover = helper.getView(R.id.iv_house_cover);
        helper.setText(R.id.tv_house_title, item.getServiceName());
        helper.setText(R.id.tv_house_desc, item.getFeature());
        if ("0.00".equals(item.getPrice())) {
            tvPrice.setTextSize(12);
            helper.setText(R.id.tv_house_price, "暂不收费");
            tvUnit.setVisibility(View.INVISIBLE);
        } else {
            helper.setText(R.id.tv_house_price, item.getPrice());
        }
        if (item.getImagePath().isEmpty()) {
            return;
        } else {
            ImageDisplayUtil.showImageView(mContext, item.getImagePath(), ivCover);
        }

    }
}